﻿<html>
<head>
<title>Last 10 IDs</title>
</head>
<?php include 'layout.php'; ?> 

	
	<body>
	<div id="content">
		<table>
			<?php
			$db = mysql_connect("mysql513.in.shared-server.net:16033", "JRtu434", "qvoiceDB1");
 			mysql_select_db("JRtu434", $db);
			$query = "Select sum(if(status=\"named\",1,0)) as listed,
			sum(if(status=\"client\",1,0)) as client,
			sum(if(status=\"pot\",1,0)) as Potential,
			sum(if(status=\"met\",1,0)) as met,
			sum(if(status=\"contacted\",1,0)) as contacted,
			sum(if(status=\"ref\",1,0)) as refused,
			sum(System) as system,
			sum(knowhow) as knowhow,
			sum(panel) as panel,
			sum(Casro) as casro,
			sum(edited)/count(ID)*100 as completionpercent,
			sum(edited) as edited,
			count(ID) as total
			from companies";
			$res = mysql_query($query);
			$record = mysql_fetch_array($res);
			?>
			<tr>
			<tr>
				<td>
					Client:
				</td>
				<td>
					<?=$record["client"]?>
				</td>
			</tr>
			<tr>
				<td>
					Potential:
				</td>
				<td>
					<?=$record["Potential"]?>
				</td>
			</tr>
			<tr>
				<td>
					Met/Talked with:
				</td>
				<td>
					<?=$record["met"]?>
				</td>
			</tr>
			<tr>
				<td>
					Contacted:
				</td>
				<td>
					<?=$record["Contacted"]?>
				</td>
			</tr>
				<td>
					Listed:
				</td>
				<td>
					<?=$record["listed"]?>
				</td>
			</tr>
			<tr>
				<td>
					Refused:
				</td>
				<td>
					<?=$record["refused"]?>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<hr>
				</td>
			</tr>
			<tr>
				<td>
					System:
				</td>
				<td>
					<?=$record["system"]?>
				</td>
			</tr>
			<tr>
				<td>
					KnowHow:
				</td>
				<td>
					<?=$record["knowhow"]?>
				</td>
			</tr>
			<tr>
				<td>
					Panel:
				</td>
				<td>
					<?=$record["panel"]?>
				</td>
			</tr>
			<tr>
				<td>
					Casro:
				</td>
				<td>
					<?=$record["casro"]?>
				</td>
			</tr>
			<tr><td colspan="2"><hr></td>
			</tr>
			<tr>
				<td>
					Percent complete:<br>
				</td>
				<td>
					<?=number_format($record["completionpercent"],2)?>%
				</td>
			</tr>
			<tr>
				<td colspan="2">
					Edited: <?=$record["edited"]?> of <?=$record["total"]?> companies.
				</td>
			</tr>
		</table>
	</div>
</body>

</html> 
